import { link } from '../../vant-weapp/dist/mixins/link'
import { VantComponent } from '../../vant-weapp/dist/common/component'
VantComponent({
  mixins: [link],
  props: {
    customClass: String,
    value: {
      type: Boolean,
      value: false
    },
    refresherEnabled: {
      type: Boolean,
      value: false
    },
    refresheTriggered: {
      type: Boolean,
      value: false
    }
  },
  data: {
    triggered: false,
    freshing: false
  },
  mounted () {
    this.triggered = this.refresheTriggered
  },
  methods: {
    onPulling (e) {
      this.triggered = true
    },
    onRefresh () {
      if (this.freshing) return
      this.freshing = true
      this.$emit('refresh')
    },

    onRestore (e) {
      console.log('onRestore:', e)
    },

    onAbort (e) {
      console.log('onAbort', e)
    },
    // 上拉加载
    onNextLoad () {
      console.log('scroll view will on load data')
      this.freshing = false
      this.triggered = false
      this.$emit('load')
    }
  }
})
